package com.shadowtorcher.TableRolePlayingSystem.controller.WebSocket;


import org.springframework.web.socket.WebSocketSession;

import java.util.HashMap;

public class WebSocketPool {
    private HashMap<WebSocketSession, WebSocketUser> sessionPool = new HashMap<>();

    public WebSocketUser getUser(WebSocketSession webSocketSession) {
        return this.sessionPool.get(webSocketSession);
    }

    public void addNewUser(WebSocketUser webSocketUser, WebSocketRoom webSocketRoom) {
        sessionPool.put(webSocketUser.getSession(), webSocketUser);
    }

    public void removeUser(WebSocketSession webSocketSession) {
        this.sessionPool.remove(webSocketSession);
    }
}
